<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../config.inc.php");

$_LangPath = "top";	//語言檔參數，務必放在最前面
include_once(__Member_Path."/logincheck_nodb.php");
include_once(__Language_Path."/selectlanguage_member.php");
include_once(__Common_Path."/Lotto.inc.php");
include_once(__Common_Path."/SysParam.inc.php");
include_once(__Modules_Path."/Lotto.lib.php");

$intLID = (int)$_data["LottoID"];
if($intLID == 0)$intLID = 1;

switch($intLID){
	case 2:
	case 3:
	case 6:
	case 7:
	case 8:
		$fp = @file(__Root_Path."/indexpage/top_member3d.html");
		$strType = "stype=o";
		break;

	case 4:
		$fp = @file(__Root_Path."/indexpage/top_member7s.html");
		$strType = "stype=o";
		break;

	case 5:
		$fp = @file(__Root_Path."/indexpage/top_member10m.html");
		$strType = "stype=o";
		break;

	default:
		$fp = @file(__Root_Path."/indexpage/top_member.html");
		$strType = "stype=c";
		break;
}


$fp = implode("", $fp);
$fp = setHTMLCharset($fp);
$fp = str_replace("{MemID}", $_SESSION["Member_Info"] -> ID,$fp);
$fp = str_replace("{sid}", $_data["sid"], $fp);
$fp = str_replace("../membertemplate/", "", $fp);
$fp = str_replace(".html?", ".php?", $fp);
$fp = str_replace("specialnumber_o", "specialnumber", $fp);
$fp = str_replace("number51_o", "number51", $fp);
$fp = str_replace("10m1_o", "10m1", $fp);
$fp = str_replace("stype=o", $strType, $fp);
$fp = str_replace("{ShowLID}", $intLID, $fp);
$fp = str_replace("{SkypeAcc}", $_KSysParam[SkypeAcc], $fp);
$fp = preg_replace("/<!-- L".$intLID." st \/\/-->.*<!-- L".$intLID." end \/\/-->/", "", $fp);

while(list($k, $v) = each($_strTop)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

$strLCon = "";
$arrLottoPower = getLottoUsePowerArray();
preg_match("/<!--@ Lotto Start @\/\/-->(.+)<!--@ Lotto End @\/\/-->/s", $fp, $arrLCon);
foreach($arrLottoPower as $intLottoID){
	$strTmp = $arrLCon[1];

	$arrLotto = $_arrLotto[$intLottoID];
	$strTmp = str_replace("{Lotto_2}", $arrLotto["Lotto_".$_intLang], $strTmp);
	if($intLottoID == $intLID){
		$strTmp = str_replace("{SelectLotto}", $arrLotto["Lotto_".$_intLang], $strTmp);
		$strTmp = str_replace("{Located2}","located", $strTmp);
	}
	$strTmp = str_replace("2", $intLottoID, $strTmp);
	$strLCon = $strTmp."\n".$strLCon;
}
$fp = preg_replace("/<!--@ Lotto Start @\/\/-->.+<!--@ Lotto End @\/\/-->/s", $strLCon, $fp);

//輸出
WebOutputHTML($fp, 1);
?>